package com.vhall.component.plugin.common.utils.algorithm;

import cn.hutool.crypto.digest.MD5;

/**
 * MD5方式签名生成
 *
 * @author yuanzh
 * @date 2021/9/8
 */
public class Md5SignGenerator implements ISignGenerator {

    @Override
    public String sign(String content, String signKey, String charset) {
        return MD5.create().digestHex(signKey + content + signKey);
    }

    @Override
    public boolean verify(String content, String charset, String signKey, String signature) {
        String generateSign = sign(content, signKey, charset);
        return generateSign.equalsIgnoreCase(signature);
    }
}
